home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 029a / tsbat27.zip / ARC2ZIP.BAT < prev    next >
DOS Batch File  |  1991-06-15  |  4KB  |  132 lines

  1. echo off
  2. rem
  3. rem Do not distribute ARC2ZIP.BAT separately from the rest of the package
  4. rem
  5.  
  6. rem If you get an "Out of environment space" message, increase your
  7. rem environment space by using shell configuration in config.sys:
  8. rem Example: shell=c:\bin\command.com /e:1024 /p
  9.  
  10. echo.
  11. echo ┌───────────────────────────────────────────────────────────────┐
  12. echo │ Convert and datestamp a single .arc to .zip file with comment │
  13. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Sat 15-Jun-1991       │
  14. echo └───────────────────────────────────────────────────────────────┘
  15. if not "%1"=="" goto _continue
  16. echo.
  17. echo Usage: ARC2ZIP PackageName [/r(eplace the old .arc with the new .zip)]
  18. echo Use no drive name! No extension!
  19. echo        ┌───────────────┐
  20. echo        │ NO WILDCARDS! │
  21. echo        └───────────────┘
  22. echo.
  23. echo When using for the first time:
  24. echo  1) Copy pkunpak.exe and pkzip.exe to a:\ (not provided)
  25. echo  2) Make a new directory a:\zip for converted files
  26. echo  3) Edit your own zip-file comment to a:\comment.txt (not provided)
  27. echo  4) If you do not have a ramdisk on r:\ alter line a:\pkzip -br:\ «-- ...
  28. echo  5) If you use a harddisk, edit the paths in ARC2ZIP.BAT as appropriate
  29. echo.
  30. echo Usually:
  31. echo  Put the .arc file diskette in drive b:\
  32. echo  Put the ARC2ZIP.BAT diskette in drive a:\
  33. echo  And run normally
  34. goto _out
  35.  
  36. :_continue
  37. rem Do the necessary programs, the comment file, and zip directory exist
  38. if not exist a:\pkzip.exe goto _err1
  39. if not exist a:\pkunpak.exe goto _err2
  40. if not exist a:\comment.txt goto _err3
  41. if not exist a:\zip\nul goto _err8
  42.  
  43. rem Build the names for source .arc and target .zip files
  44. set _filea=b:\%1.arc
  45. set _filez=a:\zip\%1.zip
  46. if not exist %_filea% goto _err4
  47. if exist %_filez% goto _err5
  48. if not exist a:\tmp$$$\nul md a:\tmp$$$
  49. if exist a:\tmp$$$\*.* goto _err9
  50.  
  51. rem Test archive integrity
  52. a:\pkunpak -t %_filea%
  53. if errorlevel==1 goto _err10
  54.  
  55. rem Convert, use the date of the latest file, not the current date
  56. a:\pkunpak %_filea% a:\tmp$$$
  57. a:\pkzip -a %_filez% a:\comment.txt
  58. a:\pkzip -z %_filez% < a:\comment.txt
  59. a:\pkzip -d %_filez% comment.txt
  60. a:\pkzip -br:\ -u -m -o %_filez% a:\tmp$$$\*.*
  61. a:\pkzip -v %_filez%
  62. rd a:\tmp$$$
  63.  
  64. rem State of the /r switch for replacing the old .arc file
  65. if "%2"=="/r" goto _replace
  66. if "%2"=="/R" goto _replace
  67. goto _out
  68.  
  69. rem Replace the old .arc file with the new .zip file
  70. :_replace
  71. echo To replace %_filea% with %_filez% press any key
  72. echo To cancel, use the Break key now
  73. pause >nul
  74. if not exist %_filez% goto _err6
  75. if exist %_filea% del %_filea%
  76. if exist %_filea% goto _err7
  77. copy %_filez% b:\
  78. del %_filez%
  79. dir b:\%1.zip
  80. goto _out
  81.  
  82. :_err1
  83. Echo File a:\pkzip.exe not found
  84. goto _out
  85.  
  86. :_err2
  87. Echo File a:\pkunpak.exe not found
  88. goto _out
  89.  
  90. :_err3
  91. Echo File a:\comment.txt not found
  92. goto _out
  93.  
  94. :_err4
  95. Echo File %_filea% not found
  96. echo.
  97. echo Usage: ARC2ZIP PackageName [/r(eplace the old .arc with the new .zip)]
  98. echo Use no drive name! No extension!
  99. echo        ┌───────────────┐
  100. echo        │ NO WILDCARDS! │
  101. echo        └───────────────┘
  102. goto _out
  103.  
  104. :_err5
  105. Echo File %_filez% already exists
  106. goto _out
  107.  
  108. :_err6
  109. Echo ARC2ZIP aborted: File %_filez% not found
  110. goto _out
  111.  
  112. :_err7
  113. Echo ARC2ZIP aborted: Disk or file %_filea% is readonly
  114. goto _out
  115.  
  116. :_err8
  117. Echo Error: Directory a:\zip does not exist
  118. goto _out
  119.  
  120. :_err9
  121. Echo Error: Directory a:\tmp$$$ is not empty
  122. goto _out
  123.  
  124. :_err10
  125. Echo ARC2ZIP aborted: Error in %_filea%
  126. goto _out
  127.  
  128. :_out
  129. set _filea=
  130. set _filez=
  131. echo on
  132.